package com.xbchzh.clifford.beans;

import java.util.List;

public class PageBean {
	private List recordList;  //记录
	private int pageCount;//总页数
	private int pageSize;//每页显示记录数
	private int currentPage;//当前页码
	private int recordCount;//总记录数
	private int beginPageIndex;//开始页码
	private int endPageIndex;//结束页码
	
	public PageBean(){
		
	}
	
	/**
	 * @param recordList
	 * @param pageSize
	 * @param currentPage
	 * @param recordCount
	 */
	public PageBean(List recordList, int pageSize, int currentPage,
			int recordCount) {
		super();
		this.recordList = recordList;
		this.pageSize = pageSize;
		this.currentPage = currentPage;
		this.recordCount = recordCount;
		//页面数
		pageCount = (recordCount + pageSize - 1)/pageSize; 
		//璁＄畻beginPageIndex,endPageIndex
		
		//当页面数>5时
		if(pageCount<5){
			beginPageIndex = 1;
			endPageIndex = pageCount;
		}else{
			beginPageIndex = currentPage - 2;
			endPageIndex = pageCount + 2;
			if(beginPageIndex < 1){
				beginPageIndex = 1;
				endPageIndex = 5;
			}else if(endPageIndex > pageCount){
				beginPageIndex = pageCount - 4;
				endPageIndex = pageCount;
			}
		}
	}
	
	public List getRecordList() {
		return recordList;
	}
	public void setRecordList(List recordList) {
		this.recordList = recordList;
	}
	public int getPageCount() {
		return pageCount;
	}
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getRecordCount() {
		return recordCount;
	}
	public void setRecordCount(int recordCount) {
		this.recordCount = recordCount;
	}
	public int getBeginPageIndex() {
		return beginPageIndex;
	}
	public void setBeginPageIndex(int beginPageIndex) {
		this.beginPageIndex = beginPageIndex;
	}
	public int getEndPageIndex() {
		return endPageIndex;
	}
	public void setEndPageIndex(int endPageIndex) {
		this.endPageIndex = endPageIndex;
	}
	
}
